<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">app</div>

  <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
  <script src="https://unpkg.com/babel-standalone@6/babel.min.js" crossorigin></script>

  <script type="text/babel">
    
    class App extends React.Component {
      constructor() {
        super()

        this.state = {
          message: 'Hello React',
          movies: ['星球大战', '盗梦空间', '蜘蛛侠', '钢铁侠']
        }
      }

      render() {
        const liArray = []

        for (let movie of this.state.movies) {
          liArray.push(<li>{movie}</li>)
        }

        return (
          <div>
            <h2>电影列表</h2>
            <ul>
              {liArray}
            </ul>

            <h2>姜总列表</h2>
            <ul>
              {
                this.state.movies.map((item, index) => {
                  return <li>{item}</li>
                })
              }
            </ul>
          </div>
        )
      }
    }

    ReactDOM.render(<App />, document.getElementById('app'))
  </script>
</body>
</html>